<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:security="http://www.springframework.org/security/tags"
      xmlns:p="http://primefaces.org/ui">

	<ui:composition template="/templates/interna.xhtml">

	<ui:define name="titulo">
    	Cadastro de Ticket
	</ui:define>
	
	<ui:define name="corpo">
		<h:form id="cadastro">
			<h:messages/>
			<h:inputHidden value="#{ticketBean.ticket.id}"/>
		
			<h:inputHidden value="#{ticketBean.destinoSalvar}"/>
			
	<p:tabView id="tabView">  
  
    <p:tab id="tabDadosCadastrais" title="Dados do Ticket">  
        <h:panelGrid columns="2">
				<h:outputLabel value="Título:" for="titulo" align="right"/>
				<h:inputText id="nome" label="Nome" value="#{ticketBean.ticket.titulo}" size="30" maxlength="30" required="true" requiredMessage="Informe um título para o ticket">
					<f:validateLength minimum="2" maximum="30"/>
				</h:inputText>
				
				<h:outputLabel value="Descrição:" for="descricao" align="right"/>
				<h:inputText id="descricao" label="Descrição" value="#{ticketBean.ticket.descricao}" size="30" maxlength="30" required="true" requiredMessage="Informe a descrição">
					<f:validateLength minimum="2" maximum="30"/>
				</h:inputText>
				
			
				
			
				
				<h:outputLabel value="componente" for="componente" align="right"/>
				<h:panelGroup>
					<h:selectOneMenu value="#{contextoBean.componente.componente}"
						valueChangeListener="#{contextoBean.setComponente}" 
						rendered="#{!empty contextoBean}"
						onchange="submit()">
						<f:selectItems 	value="#{componenteBean.lista}" 
										var="componente"
										itemValue="#{componente.componente}"
										itemLabel="#{componente.nome}"/>
					</h:selectOneMenu> 
				</h:panelGroup>
				
				
				
				</h:panelGrid>
	  
    </p:tab>  
  
</p:tabView> 
			
						
			<h:commandButton action="#{ticketBean.salvar}" value="Salvar"/>
			
		</h:form>
	</ui:define>
	
	</ui:composition>
</html>